package com.system.stockservice.bus;


import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

@Component
//@RunWith(SpringRunner.class)
public class TestSender {

    @Autowired
    private AmqpTemplate amqpTemplate;

//    @Test
    public void send(Integer code,String msg){
//        String orders_no = "hello "+ LocalDateTime.now().toString();
        System.out.println("用户服务发送消息:"+msg);
        this.amqpTemplate.convertAndSend("stockservice",code+":"+msg);
    }
}
